﻿using System;

namespace ForgeCraft
{
    public class CmdObject : Command
    {
        public override string name { get { return "object"; } }
        public override string shortcut { get { return ""; } }
        public override string type { get { return "op"; } }
        public override bool consoleUsable { get { return false; } }
        public override Permission defaultRank { get { return Permission.Operator; } }
        public CmdObject() { }

        public override void Use(Player p, string message)
        {
            ObjectItem newObj = new ObjectItem();

            byte type = 0;

            byte.TryParse(message, out type);

            if (type > 0)
            {
                newObj.Type = type;
                new ObjectEntity((int)p.pos.x, (int)p.pos.y, (int)p.pos.z, newObj, p.currentWorld);
            }
        }

        public override void Help(Player p)
        {
            p.Message(Color.Aqua + "/object " + Color.Help + "- Spawns an object.");
        }
    }
}